package com.springboot.cloud.sysadmin.organization.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springboot.cloud.sysadmin.organization.entity.po.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select username \n" +
            "from users , user_role_relation\n" +
            "where users.id=user_role_relation.user_id \n" +
            "      and user_role_relation.role_id = #{roleId}")
    List<String> findUsernameByRoleId(@Param("roleId") String roleId);
}